<?php
	/**
	* Video Delete
	* 
	* @author trungdt
	* @since Oct 27, 2011
	*/
	if (!defined('EXPONENT')) exit('');

	$video = null;
	if (isset($_POST['id'])) {
		$video = $db->selectObject('videomodule_video','id='.intval($_POST['id']));
		if ($video) {
			$loc = unserialize($video->location_data);
		}
	}

	$obj=null;
	$obj->success=1;
	if ($video) {
		if (exponent_permissions_check(array('administrate',"delete"),$loc)) {
			$db->delete('videomodule_video','id='.$video->id);
			$obj->id=$video->id;
		} else {
			//echo SITE_403_HTML;
			$obj->success=0;
		}
	} else {
		//echo SITE_404_HTML;
		$obj->success=0;
	}

	echo json_encode($obj);
?>
